package socilgirl.dell.mydemo.httpmanager;

import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import okhttp3.MediaType;

/**
 * Created by ${小强} on 2017/10/27.
 */

public class DownData {
    private List<DownFile> mDownFiles;
    private String mKey;
    private List<DownInputStream> mDownInputStreams;
    private List<DownByte> mDownBytes;

    public DownData(List<DownFile> downFiles, String key, List<DownInputStream> downInputStreams, List<DownByte> downBytes) {
        mDownFiles = downFiles;
        mKey = key;
        mDownInputStreams = downInputStreams;
        mDownBytes = downBytes;
    }

    public DownData() {
    }

    public List<File> toFilesList() {
        List<File> files = new ArrayList<>();
        if (mDownFiles != null) {
            for (int i = 0; i < mDownFiles.size(); i++) {
                files.add(mDownFiles.get(i).getFile());
            }
        }
        return files;
    }

    public List<DownFile> getDownFiles() {
        return mDownFiles;
    }

    public void setDownFiles(List<DownFile> downFiles) {
        mDownFiles = downFiles;
    }

    public String getKey() {
        return mKey;
    }

    public void setKey(String key) {
        mKey = key;
    }

    public List<DownInputStream> getDownInputStreams() {
        return mDownInputStreams;
    }

    public void setDownInputStreams(List<DownInputStream> downInputStreams) {
        mDownInputStreams = downInputStreams;
    }

    public List<DownByte> getDownBytes() {
        return mDownBytes;
    }

    public void setDownBytes(List<DownByte> downBytes) {
        mDownBytes = downBytes;
    }

    public static class DownFile {

        private String mKey;
        private File mFile;
        private String mFlieName;
        private MediaType mMediaType;

        public DownFile() {
        }

        public DownFile(String key, File file, String flieName, MediaType mediaType) {
            mKey = key;
            mFile = file;
            mFlieName = flieName;
            mMediaType = mediaType;
        }

        public String getKey() {
            return mKey;
        }

        public void setKey(String key) {
            mKey = key;
        }

        public File getFile() {
            return mFile;
        }

        public void setFile(File file) {
            mFile = file;
        }

        public String getFlieName() {
            return mFlieName;
        }

        public void setFlieName(String flieName) {
            mFlieName = flieName;
        }

        public MediaType getMediaType() {
            return mMediaType;
        }

        public void setMediaType(MediaType mediaType) {
            mMediaType = mediaType;
        }
    }

    /**
     * 数据流
     */
    public static class DownInputStream {
        private InputStream mInputStream;
        private String mKey;
        private String mName;
        private MediaType mMediaType;

        public MediaType getMediaType() {
            return mMediaType;
        }

        public void setMediaType(MediaType mediaType) {
            mMediaType = mediaType;
        }

        public DownInputStream(InputStream inputStream, String key, String name, MediaType mediaType) {
            mInputStream = inputStream;
            mKey = key;
            mName = name;
            mMediaType = mediaType;
        }

        public DownInputStream() {
        }

        public InputStream getInputStream() {
            return mInputStream;
        }

        public void setInputStream(InputStream inputStream) {
            mInputStream = inputStream;
        }

        public String getKey() {
            return mKey;
        }

        public void setKey(String key) {
            mKey = key;
        }

        public String getName() {
            return mName;
        }

        public void setName(String name) {
            mName = name;
        }
    }

    /**
     * byte数组
     */
    public static class DownByte {
        private String mKey;
        private byte[] mBytes;
        private String mName;
        private MediaType mMediaType;

        public DownByte(String key, byte[] bytes, String name, MediaType mediaType) {
            mKey = key;
            mBytes = bytes;
            mName = name;
            mMediaType = mediaType;
        }

        public DownByte() {
        }

        public byte[] getBytes() {
            return mBytes;
        }

        public void setBytes(byte[] bytes) {
            mBytes = bytes;
        }

        public String getName() {
            return mName;
        }

        public void setName(String name) {
            mName = name;
        }

        public MediaType getMediaType() {
            return mMediaType;
        }

        public void setMediaType(MediaType mediaType) {
            mMediaType = mediaType;
        }

        public String getKey() {

            return mKey;
        }

        public void setKey(String key) {
            mKey = key;
        }
    }
}
